﻿using System;
using System.Collections.Generic;
using System.Security.Principal;
using ActivateYourGlutes.Infrastructure.MembershipServices;
using ActivateYourGlutes.Model.Contracts;

namespace ActivateYourGlutes.Model.Providers
{
    public interface IAccountProvider : IProviderBase
    {
        /// <summary>
        /// Creates an account
        /// </summary>
        void Create(string name, string password, string email, DateTime time, Contracts.UnitOfLength length, Contracts.UnitOfWeight weight, string dateFormat);
        /// <summary>
        /// Determines if any data has been logged by this user beyond account creation
        /// </summary>
        bool IsDataLoggedForUser(IPrincipal principal);
        /// <summary>
        /// Returns the recent activity the user has made against their account
        /// </summary>
        IEnumerable<Contracts.Activity> RecentActivity(IPrincipal user);
        /// <summary>
        /// Updates the details of an account
        /// </summary>
        void UpdateAccount(Contracts.Account forAccount, string email, DateTime exact, Contracts.UnitOfLength unitOfLength, Contracts.UnitOfWeight unitOfWeight, IEnumerable<Contracts.MeasurementType> keyIndicators);
        /// <summary>
        /// Validates the details supplied for logon
        /// </summary>
        void ValidateLogOn(string userName, string password);
        /// <summary>
        /// Validates the details supplied for registration
        /// </summary>
        void ValidateRegistration(string userName, string email, string password, string confirmPassword, bool acceptTerms, DateTime? dob);
        /// <summary>
        /// Validates the details supplied for changing a password
        /// </summary>
        void ValidateChangePassword(string currentPassword, string newPassword, string confirmPassword);
        /// <summary>
        /// Returns the email address for an account from the membership provider
        /// </summary>
        string EmailForAccount(Account account);
        /// <summary>
        /// Returns the minimum password length
        /// </summary>
        int MinPasswordLength { get; }
        /// <summary>
        /// Change the password for the given user
        /// </summary>
        bool ChangePassword(string accountName, string newPassword, string currentPassword, string confirmPassword);
    }
}